<?php $this->load->view('home/layout/header') ?>
    <div class="widthMax <?php echo (get_cookie('lotteryunid') == 71) ? 'lottery-71' : ''; ?>">
        <div class="lottery-img">
            <a href="<?php echo isset($_SERVER['HTTP_REFERER']) ? 'javascript:history.go(-1);' : site_url('home/lottery/draw'); ?>" class="drax-return">
                <i class="iconfont icon-zuojiantou"></i>
            </a>
            <a href="<?php echo site_url('home/ucenter/index'); ?>" class="drax-beizhu">
                <i class="iconfont">&#xe616;</i>
            </a>
            <div class="lottery-ul" id="winners-grid">
                <?php if ($winner->num_rows() > 0) : ?>
                    <ul>
                        <?php foreach($winner->result() as $value ) : ?>
                            <li class="flex">
                                <div class="lottery-bottom flex-1">
                                    <h4 class="am-text-truncate"><?php echo $value->prize_name; ?></h4>
                                    <p><?php echo $value->created_at; ?></p>
                                </div>
                                <div class="lottery-collar">
                                    <?php if ($value->prize_type == 4) : ?>
                                        <?php if ( $value->effective_date >= date('Y-m-d H:i:s') ): ?>
                                            <a href="javascript:;" class="lottery-receive special-prize <?php echo ($value->status == 3) ? 'lottery-receive-success' : ''; ?>" data-link="<?php echo $value->links ? $value->links : 'javascript:;'; ?>"
                                            data-img="<?php echo $this->config->show_image_url($value->image, '300-300'); ?>"
                                            data-state="<?php echo $value->status; ?>"
                                            data-status="<?php
                                                    switch ($value->status) {
                                                        case 1:
                                                            echo '确认领取奖品';
                                                            break;
                                                        case 2:
                                                            echo '请到现场领奖';
                                                            break;
                                                        case 3:
                                                            echo '颁奖成功！';
                                                            break;
                                                        default:
                                                            break;
                                                    }  ?>"
                                            data-name="<?php echo $value->prize_name; ?>" data-id="<?php echo $value->id; ?>" >
                                                <i class="iconfont">&#xe627;</i>
                                                <p><?php
                                                        switch ($value->status) {
                                                            case 1:
                                                                echo '点我领奖';
                                                                break;
                                                            case 2:
                                                                echo '待<br/>颁奖';
                                                                break;
                                                            case 3:
                                                                echo '颁奖成功';
                                                                break;
                                                            default:
                                                                break;
                                                        }
                                                    ?>
                                               </p>
                                            </a>
                                        <?php else : ?>
                                            <a href="javascript:;" >
                                                <i class="iconfont">&#xe627;</i>
                                                <p>领</p>
                                                <span class="invalid">已失效</span>
                                            </a>
                                        <?php endif; ?>
                                    <?php else : ?>
                                        <?php if ($value->status == 1) : ?>
                                            <?php if ( $value->effective_date >= date('Y-m-d H:i:s') ): ?>
                                                <a href="<?php echo ($value->prize_type == 3) ? site_url('home/winners/detail/'. $value->id) : 'javascript:;'; ?>" 
                                                class="lottery-receive <?php if ($value->prize_type == 1) { echo 'accept-prize'; } elseif ($value->prize_type == 2) {echo 'accept-virtual-prize';} elseif($value->prize_type == 3) {echo 'bz-currency';} ?>"
                                                data-link="<?php echo $value->links ? $value->links : 'javascript:;'; ?>"
                                                data-img="<?php echo $this->config->show_image_url($value->image, '300-300'); ?>"
                                                data-name="<?php echo $value->prize_name; ?>" data-id="<?php echo $value->id; ?>" >
                                                    <i class="iconfont">&#xe627;</i>
                                                    <p>点我领奖</p>
                                                </a>
                                            <?php else : ?>
                                                <a href="javascript:;" >
                                                    <i class="iconfont">&#xe627;</i>
                                                    <p>领</p>
                                                    <span class="invalid">已失效</span>
                                                </a>
                                            <?php endif; ?>
                                        <?php else : ?>
                                            <a href="<?php echo site_url('home/winners/detail/'.$value->id); ?>" class="lottery-receive">
                                                <i class="iconfont">&#xe627;</i>
                                                <p class="lottery-already">已领</p>
                                                <img src="/skins/home/images/look.png">
                                            </a>
                                        <?php endif; ?>
                                    <?php endif; ?>
                                </div>
                            </li>
                        <?php endforeach ?>
                    </ul>
                    <?php else : ?>
                        <div class="icon-none">
                            <i class="iconfont">&#xe603;</i>
                            <p>还没有中奖记录</p>
                        </div>
                    <?php endif; ?>
            </div>

            <!-- 现场颁奖 弹窗的窗口 -->
            <div class="am-modal lottery-modal" tabindex="-1" id="winners-detail-modal">
                <div class="am-modal-dialog">
                    <div class="am-modal-hd">
                        <a href="javascript:;" class="linkto"><i class="iconfont">&#xe631;</i></a>
                        <a href="javascript: void(0)" class="am-close" data-am-modal-close>&times;</a>
                    </div>
                    <div class="am-modal-bd">
                        <div class="lottery-pic">
                            <img src="" />
                        </div>
                        <p>恭喜您！获得</p>
                        <p><!--奖品名称--></p>
                    </div>
                    <div class="am-modal-fd">
                        <p><!--奖品状态--></p>
                        <div>
                            <button class="am-btn am-btn-block winners-detail-close">确定</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="lottery-foot">
            <div class="btns am-cf">
                <div class="tuiguang">
                    <a href="<?php echo site_url('home/apply/applySpread'); ?>" class="am-cf">
                        <i class="iconfont">&#xe61d;</i><span>产品推广</span><i class="draw-on iconfont">&#xe624;</i>
                    </a>
                </div>
                <div class="fenxiao">
                    <a href="<?php echo site_url('home/apply/applySeller'); ?>" class="am-cf">
                        <i class="iconfont">&#xe61e;</i><span>我要分销</span><i class="draw-on iconfont">&#xe624;</i>
                    </a>
                </div>
            </div>
            <div class="lottery-main">
                <?php if ( !empty($adverts->ad_image)) : ?>
                <a href="<?php echo isset($adverts->ad_links) ? $adverts->ad_links : 'javascript:;'; ?>">
                    <img src="<?php echo $this->config->show_image_url($adverts->ad_image);?>">
                </a>
                <?php else : ?>
                <a href="<?php echo $this->config->sales_url, 'm/weeksales/grid';?>">
                    <img src="/skins/home/images/banner.png">
                </a>
                <?php endif; ?>
                <p>更多产品详情点击进入
                <a href="<?php echo isset($adverts->links) ? $adverts->links : $this->config->sales_url. 'm/weeksales/grid'; ?>">
                    <?php echo isset($adverts->text) ? $adverts->text : '周周特惠'; ?>
                </a>
                </p>
            </div>
        </div>
    </div>

<!--实物-->
<div class="am-modal accpet-modal" tabindex="-1" id="accept-prize-modal">
    <div class="am-modal-dialog">
        <a href="javascript: void(0)" class="am-close" data-am-modal-close="">×</a>
        <div class="am-modal-bd">
            <div class="new-img">
                <div class="new-zanzhushang"><a href="javascript:;">赞助商的站点></a></div>
                <div class="new-text">
                    <p>恭喜您！已获得</p>
                    <p>临安山核桃礼盒装一盒</p>
                    <img class="prize-image" src="/skins/home/images/you.png" />
                </div>
                <div class="new-label">
                    <h3>请正确填写如下信息:</h3>
                    <p class="new-span">(以便我们快速准确地发放奖品)</p>
                </div>
            </div>

            <div class="new-form">
                <form method="post">
                    <input type="hidden" name="id">
                    <input type="hidden" name="province_id">
                    <input type="hidden" name="city_id">
                    <input type="hidden" name="district_id">
                    <input type="hidden" name="provinceName" value="省">
                    <input type="hidden" name="cityName" value="市">
                    <input type="hidden" name="districtName" value="区">
                    <table class="form-table am-table">
                        <tbody>
                        <tr>
                            <td class="form-label">真实姓名</td>
                            <td>
                                <input type="text" name="receiver_name">
                            </td>
                        </tr>
                        <tr>
                            <td class="form-label">手机号码</td>
                            <td>
                                <input type="tel" name="tel" >
                            </td>
                        </tr>
                        <tr>
                            <td class="form-label">所在区域</td>
                            <td>
                                <div class="select-city">
                                    <div class="txt-wrap">
                                        <input type="text" id="region-name" placeholder="请选择省、市、区" readOnly="true" class="addressWare" data-am-modal="{target: '#region-alert'}" />
                                        <span class="caret"></span>
                                    </div>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="form-label">详细地址</td>
                            <td>
                                <input type="text" name="detailed">
                            </td>
                        </tr>
                        <tr>
                            <td class="form-label"></td>
                            <td>
                                <button type="submit">提交</button>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </form>
            </div>
        </div>
    </div>
</div>


<!-- 地址 -->
<div class="stadd-city am-modal-actions" id="region-alert">
    <div class="bank-head flex">
        <i class="iconfont" data-am-modal-close="">&#xe62f;</i>
        <p class="flex-1">请选择城市</p>
    </div>
    <dl class="flex city-dl">
        <dd class="active region-title" data-type="1">
            <p id="province_name">省</p>
        </dd>
        <dd class="region-title" id="cities-title" data-type="2">
            <p id="city_name">市</p>
        </dd>
        <dd class="region-title" id="districts-title" data-type="3">
            <p id="district_name">区</p>
        </dd>
    </dl>
    <div class="city-blank flex">
        <div class="city-scroller scroller-provinces flex-1 ">
            <div class="scroller" id="provinces-list">
                    <?php $this->load->view('home/address/ajaxRegion'); ?>
            </div>
        </div>
        <div class="city-scroller scroller-cities flex-1 ">
            <div class="scroller" id="cities-list">
                <!--市-->
            </div>
        </div>
        <div class="city-scroller scroller-districts flex-1 active">
            <div class="scroller" id="districts-list">
                <!--区-->
            </div>
        </div>
    </div>
</div>


<!-- 虚拟 -->
<div class="am-modal accpet-modal" tabindex="-1" id="accept-virtual-prize-modal">
    <div class="am-modal-dialog">
        <a href="javascript: void(0)" class="am-close" data-am-modal-close="">×</a>
        <div class="am-modal-bd">
            <div class="new-img">
                <div class="new-zanzhushang"><a href="javascript:;">赞助商的站点></a></div>
                <div class="new-text">
                    <p>恭喜您！已获得</p>
                    <p>1000元代金券一张</p>
                    <img src="/skins/home/images/you.png" />
                </div>
                <div class="new-label">
                    <h3>请正确填写如下信息:</h3>
                    <p class="new-span">(以便我们快速准确地发放奖品)</p>
                </div>
            </div>

            <div class="new-form">
                <form method="post">
                    <input type="hidden" name="id">
                    <table class="form-table am-table">
                        <tbody>
                            <tr>
                                <td class="form-label">真实姓名</td>
                                <td>
                                    <input type="text" name="receiver_name">
                                </td>
                            </tr>
                            <tr>
                                <td class="form-label">手机号</td>
                                <td><input type="tel" name="tel"></td>
                            </tr>
                            <tr>
                                <td class="form-label">身份证</td>
                                <td>
                                    <input type="text" name="sfz">
                                </td>
                            </tr>
                            <tr>
                                <td class="form-label"></td>
                                <td>
                                    <button type="submit">提交</button>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </form>
            </div>
        </div>
    </div>
</div>

<?php echo $this->load->view('home/layout/footer'); ?>
<?php js('home', 'pages/winners', 20160719)?>
<?php js('home', 'pages/address')?>
